import java.io.IOException;
import java.sql.SQLException;
import java.sql.Statement;

import javax.xml.parsers.ParserConfigurationException;

import org.xml.sax.SAXException;

import utils.database.DB;
import utils.database.DBStream;
import utils.timer.Timer;

import loader.dewey.DeweyLoaderXml;
import loader.dewey.operations.DeweyOperations;


public class TesteDewey {

	public static void main(String[] args) throws SAXException, IOException, SQLException, ParserConfigurationException
	{
		DBStream.ClearBD();				
		
		Timer t = new Timer();
		t.start();
		DeweyLoaderXml deweyLoader = new DeweyLoaderXml();
		deweyLoader.Load("xml/hamlet.xml");
		t.stop();
		
		System.out.println("O tempo para carregar o xml foi " + t.timeElapsed()  + " ms");
		
		t.start();
		DeweyOperations op = new DeweyOperations();
		for(int i = 10; i > 0; i--)
			op.copyLastToFirst("ACT 0-" + i);
		DBStream.flush();
		t.stop();
		System.out.println("Operações de update >> " + t.timeElapsed() + " ms");
		
		t.start();
		op.delete();
		t.stop();
		
		System.out.println("Operação de delete >> " + t.timeElapsed() + " ms");
		
	}
}

